<?php
class W2MapInfoList extends AppModel
{
    public $name = 'W2MapInfoList';
    public $primaryKey = '_id';

    public function set_all_data($_db_name, $_data)
    {
        $this->useDbConfig = $_db_name['game_data'];
        $this->deleteAll(array('_id not' => null));

        foreach($_data as $action) {
            $this->create();
            if(!$this->save($action))
                return false;
        }
        return true;
    }

    public function get_map_id($_db_name)
    {
        $this->useDbConfig = $_db_name['game_data'];
        $params = array(
            'fields' => array('Id'),
            'order' => array('Id' => 'ASC'),
        );

        $data = $this->find('all', $params);
        return $data;
    }
}